# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-jba-printsrc
pkgver=0.2.2
pkgrel=1
pkgdesc="Printing Go Values as Source"
arch=('any')
url="https://github.com/jba/printsrc"
license=('MIT')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/jba/printsrc/archive/v$pkgver.tar.gz")
sha512sums=('a0e42ea2e0649d43fe5d45f798900872cbe0b75c985ce9d0690c023108d832f5931226698bb8edce7bcbdd0d8855846fc84263feb07d694728a18c0d18e41669')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/jba
  cp -a "$srcdir"/printsrc-$pkgver "$srcdir"/build/src/github.com/jba/printsrc
  cd "$srcdir"/build/src/github.com/jba/printsrc
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/jba
  cp -a "$srcdir"/printsrc-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/jba/printsrc

  install -Dm644 printsrc-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
